/*
 * Copyright 2009 rashaguo <rashaguo@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef NATNETWORK_H
#define NATNETWORK_H

#include <string>

class NatNetwork
{
public:

    static NatNetwork *getInstance()
    {
        static NatNetwork net;
        return &net;
    }

    ~NatNetwork();

    enum NatType {

        FullClone,
        RestrictClone,
        PortRestictClone,
        Symmetric,
        Unknown

    };

    // The fuction can resolve all the infomation like IP NAT
    // should be called in the first time

    void init();

    void resolveLocal();

    void resolveNat();

    std::string getLocalIP();

    std::string getNatIP();

    bool isInNat();

    enum NatType getNatType();

    std::string getNatPort(std::string  local_port);

    // TBD
    void sendTestPacket();

    bool isReachable();

private:

    NatNetwork();

    std::string m_localIP;

    std::string m_natIP;

    enum NatType m_natType;

    bool m_isNat;

    bool m_isLocalResolved;

    bool m_isNatResolved;
};

#endif
